using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
    [Table("Pool", "", "Wicresoft.Messages.ConnectionString")]
    public class Pool : Info
    {
        #region SQL column name consts
        public const string SQLCOL_POOLID = "PoolID";
        public const string SQLCOL_DEVICEID = "DeviceID";
        public const string SQLCOL_PARAMETER = "Parameter";
        public const string SQLCOL_POOLORDER = "PoolOrder";
        #endregion


        #region Contructors
        /// <summary>
        /// Construct empty entity
        /// </summary>
        public Pool() { }

        /// <summary>
        /// Construct entity by primary key, other fields will be assigned by 
        /// "Load" method.
        /// </summary>
        public Pool(Guid PoolID)
        {
            this.PoolID = PoolID;
        }
        #endregion

        public override void Init(DataRow row)
        {
            PoolID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_POOLID]);
            DeviceID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_DEVICEID]);
            Parameter = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_PARAMETER]);
            PoolOrder = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_POOLORDER]);
        }

        #region Properties
        #region Property <Guid> PoolID
        [Property("PoolID", 16, SqlDbType.UniqueIdentifier, false, true)]
        public Guid PoolID
        {
            get { return _PoolID; }
            set { _PoolID = value; }
        }
        private Guid _PoolID = Guid.Empty;
        #endregion

        #region Property <int> DeviceID
        [Property("DeviceID", 4, SqlDbType.Int, false, false)]
        public int DeviceID
        {
            get { return _DeviceID; }
            set { _DeviceID = value; }
        }
        private int _DeviceID = int.MinValue;
        #endregion

        #region Property <string> Parameter
        [Property("Parameter", 200, SqlDbType.NVarChar, false, false)]
        public string Parameter
        {
            get { return _Parameter; }
            set { _Parameter = value; }
        }
        private string _Parameter = null;
        #endregion

        #region Property <int> PoolOrder
        [Property("PoolOrder", 4, SqlDbType.Int, false, false)]
        public int PoolOrder
        {
            get { return _PoolOrder; }
            set { _PoolOrder = value; }
        }
        private int _PoolOrder = int.MinValue;
        #endregion
        #endregion




    }
}
